cmake_minimum_required(VERSION 3.5)


add_library(vehicle_lmpc_base vehicle_lmpc_base.cpp)
target_link_libraries(vehicle_lmpc_base  LMPC yaml-cpp vehicle_kf 
${catkin_LIBRARIES} VehicleDyn linear_steady_state)

add_library(vehicle_lateral_speed3dis_mpc vehicle_lateral_speed3dis_mpc.cpp)
target_link_libraries(vehicle_lateral_speed3dis_mpc VehicleDyn LMPC yaml-cpp vehicle_kf vehicle_lmpc_base)

add_library(vehicle_lateral_speed_mpc vehicle_lateral_speed_mpc.cpp)
target_link_libraries(vehicle_lateral_speed_mpc VehicleDyn LMPC yaml-cpp vehicle_kf vehicle_lmpc_base)

add_library(vehicle_lateral_speed_yaw_mpc vehicle_lateral_speed_yaw_mpc.cpp)
target_link_libraries(vehicle_lateral_speed_yaw_mpc VehicleDyn LMPC yaml-cpp vehicle_kf vehicle_lmpc_base)

add_library(vehicle_vy_yaw_error_3dis_mpc vehicle_vy_yaw_error_3dis_mpc.cpp)
target_link_libraries(vehicle_vy_yaw_error_3dis_mpc VehicleDyn LMPC yaml-cpp vehicle_kf utilities vehicle_lmpc_base)

add_library(vehicle_ll_mpc vehicle_ll_mpc.cpp)
target_link_libraries(vehicle_ll_mpc VehicleDyn LMPC yaml-cpp vehicle_kf utilities vehicle_lmpc_base)

#add_library(vehicle_ll_socp_mpc vehicle_ll_socp_mpc.cpp)
#target_link_libraries(vehicle_ll_socp_mpc VehicleDyn LMPC yaml-cpp vehicle_kf utilities vehicle_lmpc_base)

add_library(vehicle_ll_4s4s_mpc vehicle_ll_4s4s_mpc.cpp)
target_link_libraries(vehicle_ll_4s4s_mpc VehicleDyn LMPC yaml-cpp vehicle_kf utilities vehicle_lmpc_base)

add_library(vehicle_cvx_mpc_base vehicle_cvx_mpc_base.cpp)
target_link_libraries(vehicle_cvx_mpc_base VehicleDyn CvxMpc yaml-cpp vehicle_kf utilities)

add_library(vehicle_ll_socp_mpc vehicle_ll_socp_mpc.cpp)
target_link_libraries(vehicle_ll_socp_mpc VehicleDyn CvxMpc yaml-cpp vehicle_kf utilities vehicle_cvx_mpc_base)

add_library(vehicle_mpc INTERFACE)
target_link_libraries(vehicle_mpc INTERFACE
						vehicle_lmpc_base
						vehicle_lateral_speed3dis_mpc
						vehicle_lateral_speed_mpc
						vehicle_lateral_speed_yaw_mpc
						vehicle_vy_yaw_error_3dis_mpc
						vehicle_ll_mpc
						vehicle_ll_4s4s_mpc
						vehicle_cvx_mpc_base
						vehicle_ll_socp_mpc
		)
set(test_vehicle_mpc_path "${CMAKE_CURRENT_SOURCE_DIR}/test/test_yaml/")  
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test/test_vehicle_mpc_path.h.in 
${CMAKE_CURRENT_SOURCE_DIR}/test/test_vehicle_mpc_path.h)

add_executable(test_vehicle_lmpc test/test_vehicle_lmpc.cpp)
target_link_libraries(test_vehicle_lmpc  vehicle_mpc  vehicle_lmpc_base ${PYTHON_LIBRARIES}) 
target_include_directories(test_vehicle_lmpc PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test/)

add_executable(test_ll_lmpc_4d4s test/test_ll_lmpc_4d4s.cpp)
target_link_libraries(test_ll_lmpc_4d4s  vehicle_mpc  vehicle_lmpc_base ${PYTHON_LIBRARIES}) 
target_include_directories(test_ll_lmpc_4d4s PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test/)

add_executable(test_vy_yaw_error3dis_mpc test/test_vy_yaw_error3dis_mpc.cpp)
target_link_libraries(test_vy_yaw_error3dis_mpc  vehicle_mpc  vehicle_lmpc_base ${PYTHON_LIBRARIES}) 
target_include_directories(test_vy_yaw_error3dis_mpc PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test/)